jQuery(document).delegate(".aa-tabLabel","click",function(){var b=this.getAttribute("for")||this.getAttribute("data-for");if(b){var a=jQuery(this).parents(":has(.aa-tabs)");if(a.length){jQuery(".aa-tabLabel, .aa-tab",a[0]).removeClass("aa-activeTab");jQuery(b,a[0]).addClass("aa-activeTab");jQuery(this).addClass("aa-activeTab")}}});window.be=window.be||{};window.bd=window.bd||{};be.utils=(function(window,$){var cache={},loads=0,to,notification,DEFAULT_AJAX_TIMEOUT=60000,MSG_PROCESSING="processing...",MSG_TIMEOUT="Request to the server has timed out. Please try again.",contextRoot=be.contextRoot||bd.contextRoot||(b$.portal&&b$.portal.config&&b$.portal.config.serverRoot)||"",getURLRoot,getTemplateDataFromForm,getDateString,domReady,domJsReady,loadTemplate,loadTemplateByUrl,loadTemplateByDifferentUrl,loadCSSByUrl,inProgress,showLoadMessage,_showLoadMessage,hideLoadMessage,isIgnoredCall,ajax,processHTMLTemplateByUrl,processHTMLTemplate,processXMLTemplate,processXMLTemplateByUrl,processTemplate,removeNonAlphaNumericChars,trimString,replaceRefuzingChars,formatAllowedName,formatAllowedFriendlyUrl,formatAllowedPath,formatAllowedTitle,xmlEscape,replacePlaceHolders,replaceParams,xpathSingleNode,xpathSetSingleNodeValue,xpathNodes,xml2text,removeSelectedOption,getSelectionValue,resetFormValues,insertOption,alert,confirm,cssClass,unique,delay,CustomMethodForValidator,addCustomMethodToValidator,ISODateString,fromISO,truncateText,bytesToSize,mergeJsonObj,getWindowSize,varicalPagination,log,serializeJSON,convertToArray,getNodeText,digitString,isString,stripHTML,isInteger,formatDate,daysInMonth,getTagContents,getCursor,nodesWrapper,clickOutside,resetOutside,isDebugging,testDelay,makeDelayedCall,mattsTest,ericsTest,notifier,calcImageSize,tryCatch,autoScroll,getBoxObject,isBrowserDetected,browserDetection,module,define,getQueryStringParam,getErrorText,padDigits,startModule,parseParamsToObject,isType,filterItems,serverStatus,throttle;var XSRF_COOKIE="BBXSRF";var XSRF_REQUEST_HEADER="X-BBXSRF";getURLRoot=function(){var urlRoot=window.location.protocol+"//"+window.location.hostname;if(window.location.port===""||window.location.port===80||window.location.port===43){return urlRoot}urlRoot+=":"+window.location.port;return urlRoot};getTemplateDataFromForm=function(formSelector){var templateData={},tempArray=jQuery(formSelector).serializeArray();jQuery.each(tempArray,function(index,field){templateData[field.name]=field.value});return templateData};getDateString=function(sDate){console.log("be.utils.getDateString is deprecated. Please use: bd.date.formatDateTime(timestamp)");var nMillisecondsInOneDay,nNowTime,oDate,sTimePart,sDatePart;nMillisecondsInOneDay=1000*60*60*24;nNowTime=new Date().getTime();oDate=new Date();oDate.setTime(Date.parse(sDate));sTimePart=(oDate.getHours()>9?oDate.getHours():"0"+oDate.getHours())+":"+(oDate.getMinutes()>9?oDate.getMinutes():"0"+oDate.getMinutes());if(nNowTime-oDate.getTime()25){clearTimeout(timeout);if(failedCallback!=null){failedCallback()}}++tries;setTimeout(retry,50)},50)};domJsReady=function(test,successCallback,failedCallback,tries,speed){var timeout=null;tries=(tries==null)?1:tries;speed=(speed==null)?50:speed;timeout=setTimeout(function retry(){var returnOutput=null;try{returnOutput=eval(test)}catch(exception){clearTimeout(timeout);console.log("exception: "+exception);if(failedCallback!=null){failedCallback(exception)}}if(returnOutput===true||returnOutput==="true"){clearTimeout(timeout);successCallback()}if(tries>25){clearTimeout(timeout);if(failedCallback!=null){failedCallback()}}++tries;setTimeout(retry,speed)},speed)};loadTemplate=function(templateName,templateType,async){return loadTemplateByUrl(contextRoot+"/static/dashboard/templates/"+templateType+"/"+templateName+"."+templateType,async)};loadTemplateByUrl=function(url,async){var dfd=$.Deferred(),htmlContent="",promise;if(cache[url]){htmlContent=$.data(document.body,url);promise=dfd.resolve(htmlContent)}else{promise=ajax({url:url,async:async||false,success:function(data){$.data(document.body,url,data);cache[url]=true;htmlContent=data},error:function(jqXHR){if(jqXHR.status==="404"){htmlContent=loadTemplateByDifferentUrl(url,async)}}})}return async?promise:htmlContent};loadTemplateByDifferentUrl=function(url,async,templateType){var htmlContent="",tmpUrl,promise;templateType=templateType||"html";tmpUrl=contextRoot+"/static/dashboard/templates/"+templateType+"/"+url+"."+templateType;promise=ajax({url:tmpUrl,async:async||false,success:function(data){htmlContent=data}});return async?promise:htmlContent};inProgress=false;showLoadMessage=function(){clearTimeout(to);loads+=1;to=setTimeout(_showLoadMessage,1500)};_showLoadMessage=function(){var _bc=top?top.bc:bc;if(loads>0&&!inProgress){inProgress=true;notification=_bc.component.notify({uid:"id"+to,className:"bd-modal-progress",icon:"loading",message:MSG_PROCESSING,delay:-1})}};hideLoadMessage=function(){if(inProgress&&loads===1){clearTimeout(to);setTimeout(function(){if(loads<1&&inProgress){notification.hide();inProgress=false}},30)}loads-=1};isIgnoredCall=function(params){return params.url.indexOf("ping.jsp")>0||params.url.indexOf(".html")>0};var cookie=function(name,value,params){var nameEncoded=encodeURIComponent(name);return jQuery.cookie(nameEncoded,value,params)};var setCookie=function(obj){obj=obj||{};jQuery.each(obj,function(name,val){document.cookie=name+"="+val})};var getCookie=function(name){var i,node,nodeArray,cookieArray,cookieMap={};if(document.cookie){cookieArray=document.cookie.split(";");for(i=0,node;node=$.trim(cookieArray[i]);i++){nodeArray=node.split("=");cookieMap[nodeArray[0]]=nodeArray[1]}return cookieMap[name]}};var getXSRFCookieName=function(){return XSRF_COOKIE};var getXSRFRequestHeaderName=function(){return XSRF_REQUEST_HEADER};var getXSRFCookie=function(){return getCookie(getXSRFCookieName())};var isMethodUnsafe=function(requestMethod){var method=typeof requestMethod==="string"?requestMethod.toUpperCase():null;return method==="POST"||method==="PUT"||method==="PATCH"||method==="DELETE"};var setXSRFHeader=function(jQueryAjaxSettings){if(isMethodUnsafe(jQueryAjaxSettings.type)){var headerName=getXSRFRequestHeaderName();var token=getXSRFCookie();if(token){jQueryAjaxSettings.headers=jQueryAjaxSettings.headers||{};jQueryAjaxSettings.headers[headerName]=token}}return jQueryAjaxSettings};var appendXSRFTagTo=function(el){var name=getXSRFCookieName();var token=getXSRFCookie();if(token){$('').val(token).appendTo(el)}return el};ajax=function(params){var cancelMessage=isIgnoredCall(params),handledData;if(!cancelMessage){showLoadMessage()}if(params.trace){console.log("ajax:",params)}if(params.htmlDecode||params.dataType==null){params.dataType="text"}if(params.async==null){params.async=true}if(params.contentType==null){params.contentType="text/xml"}if(params.processData==null){params.processData=false}if(!params.skipTimeout&&!params.timeout){params.timeout=DEFAULT_AJAX_TIMEOUT}params.successHolder=params.success;if(params.encodeURI!==false){params.url=encodeURI(params.url)}params.success=function(data,textStatus,xhr){var contentType=xhr.getResponseHeader("Content-Type"),successHolder=this.successHolder;if(!cancelMessage){hideLoadMessage()}handledData=data;if(params.htmlDecode){handledData=HTMLDecode(data);try{handledData=$.parseXML(handledData)}catch(e){}}if(contentType&&contentType.indexOf("text/html")!==-1&&xhr.responseText.indexOf("j_spring_security_check")!==-1){be.utils.sessionExpireErrorHandler()}else{tryCatch(function(){if($.isFunction(successHolder)){successHolder(handledData,textStatus,xhr)}},function(exception){console.log("be.utils.ajax > error: "+exception)},bd.devMode)}};params.errorHolder=params.error;params.error=function(xhr,textStatus,errorThrown){var txt,defaultErrorHandler;if(!cancelMessage){hideLoadMessage()}handledData=xhr;if(!window.top.bd.isPageIframeUnloaded){if(params.htmlDecode){handledData=HTMLDecode(xhr.responseText)}if(xhr.status===0&&xhr.readyState===0&&textStatus!=="timeout"){clearTimeout(ajax.to);ajax.to=setTimeout(function(){be.utils.connectionErrorHandler()},10)}if(textStatus==="timeout"&&errorThrown==="timeout"){xhr.abortedByClient=true;bc.component.notify({uid:"timeout",className:"bd-modal-progress",icon:"loading",message:MSG_TIMEOUT,delay:5000});return false}if(params.errorHolder){txt=be.utils.getErrorText(xhr,true);params.errorHolder(handledData,txt,errorThrown)}else{defaultErrorHandler=top?top.be.utils.ajaxErrorHandler:be.utils.ajaxErrorHandler;if(defaultErrorHandler){defaultErrorHandler(xhr,textStatus,errorThrown,this.url)}else{console.log("uncaught error, xhr:",{text:xhr.responseText,status:xhr.status+": "+xhr.statusText},"status:",textStatus,"error:",errorThrown)}}}};if(be.invalidateEverything===true){params.cache=false}setXSRFHeader(params);return jQuery.ajax(params).then(function(){return handledData})};processHTMLTemplateByUrl=function(url,templateData,callback){return processTemplate(null,url,templateData,null,callback)};processHTMLTemplate=function(templateName,templateData,callback){return processTemplate(templateName,null,templateData,"html",callback)};processXMLTemplate=function(templateName,templateData,callback){var xmlContent=processTemplate(templateName,null,templateData,"xml",callback);return xmlContent};processXMLTemplateByUrl=function(url,templateData,callback){return processTemplate(null,url,templateData,null,callback)};processTemplate=function(templateName,templateUrl,templateData,templateType,callback){var templateNameCache,saveContent,templateContent,onData,render,async=callback?true:false;if(cache==null){cache={}}saveContent=function(){$.data(document.body,templateNameCache,templateContent);cache[templateNameCache]=true};onData=function(data){templateContent=data;saveContent();callback(render())};render=function(){var renderObject=Mustache.to_html($.data(document.body,templateNameCache),templateData);return renderObject};if(templateUrl==null){templateNameCache=templateName+"-"+templateType}else{templateNameCache=templateUrl}if(cache[templateNameCache]==null){if(templateUrl==null){templateContent=loadTemplate(templateName,templateType,async)}else{templateContent=loadTemplateByUrl(templateUrl,async)}if(async){templateContent.done(onData)}else{saveContent()}}if(!async){return render()}if(cache[templateNameCache]){callback(render())}};removeNonAlphaNumericChars=function(inputString){return inputString.replace(/[^a-zA-Z0-9]+/g,"")};trimString=function(inputString){try{if(inputString){return inputString.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}return""}catch(e){console.log(e)}};replaceRefuzingChars=function(inputString,type){var refuzingChars;if(type==="name"){refuzingChars=/~|!|@|#|\$|%|\^|&|\*|\(|\)|\+|`|'|"|=|\[|\]|\{|\}|;|:|,|\.|\/|\\|<|>|\?/g}else{if(type==="title"){refuzingChars=/@|<|>|\?/g}else{refuzingChars=/@|&|<|>|\?/g}}inputString=inputString.replace(refuzingChars,"");return inputString};formatAllowedName=function(inputString){inputString=trimString(inputString).replace(/(\s)+/g,"-");return replaceRefuzingChars(inputString,"name").toLowerCase()};formatAllowedFriendlyUrl=function(inputString){var refuzingChars=/~|!|@|#|\$|%|\^|&|\*|\(|\)|\+|`|'|"|=|\[|\]|\{|\}|;|:|,|\\|<|>|\?/g;inputString=trimString(inputString).replace(/(\s)+/g,"-");inputString=inputString.replace(/(\/)+/g,"/");inputString=inputString.replace(/(^\/)+/g,"");inputString=inputString.replace(refuzingChars,"");return inputString};formatAllowedPath=function(inputString){inputString=trimString(inputString).replace(/(\s)+/g,"-");return replaceRefuzingChars(inputString,"path")};formatAllowedTitle=function(inputString){return replaceRefuzingChars(inputString,"title")};xmlEscape=function(text){text=text.replace(/&/g,"&");text=text.replace(//g,">");text=text.replace(/\'/g,"'");text=text.replace(/\"/g,""");return text};replacePlaceHolders=function(inputString,arrayOfValues){var i,params={};for(i=0;arrayOfValues!=null&&i=0){elOptNew=document.createElement("option");elOptNew.text=name;elOptNew.value=value;elOptOld=elSel.options[elSel.selectedIndex];try{elSel.add(elOptNew,elOptOld)}catch(ex){elSel.add(elOptNew,elSel.selectedIndex)}}else{elSel.options[elSel.options.length]=new Option(name,value);elSel.selectedIndex=0}};alert=function(params){var defaultParams={title:"Attention",message:"!",okBtnText:"Continue",closeIcon:false,respondToEscKey:false},htmlContent,dialogRef;params=$.extend(defaultParams,params||{});htmlContent=jQuery('

'+params.title+"

"+params.message+'

");be.closeCurrentDialog();dialogRef=be.openDialog({htmlContent:htmlContent.get(0),closeIcon:params.closeIcon,standAlone:true,respondToEscKey:params.respondToEscKey,callback:function(){htmlContent.find(".bd-ok").focus()},small:true});htmlContent.find(".bd-ok").click(function(e){e.preventDefault();be.closeCurrentDialog();if(params.yesCallback&&typeof params.yesCallback==="function"){params.yesCallback()}});return dialogRef};confirm=function(params){var $confirmWrapper=null,defaultParams={title:"Please confirm the action",message:'Press "Remove" button if you agree',cancelBtnText:"Cancel",okBtnText:"Remove",closeIcon:true,respondToEscKey:true},htmlContent,dialogRef;params=$.extend(defaultParams,params||{});htmlContent=jQuery('

'+params.title+"

"+params.message+'

");if(params.showTextBox){jQuery(".bd-buttons",htmlContent).before('